package com.example.yls.myapplication;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by yls on 2018/11/6.
 */

public class myBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        if (action.equals("weather_info")) {
            String weather = intent.getStringExtra("weather");
            int wendu = intent.getIntExtra("wendu", 0);
            Log.e("myBroadcastReceiver", "onReceiver weather" +
                    weather + "wendu" + wendu);

        }
        else if (action.equals("traffice_info")){
            String traffice = intent.getStringExtra("traffice");
            int time = intent.getIntExtra("time", 0);
            Log.e("myBroadcastReceiver", "onReceiver traffice" +
                    traffice + "time" + time);
        }
    }
}